package com.csun.cmny.provider.device.watch.entity;



    /// <summary>
    ///  上行语音文件配置确认包
    ///  关联下行 044
    ///  Uplink voice file configuration confirmation packet
    ///  Link Down 044
    /// </summary>
    public class C045
    {
        /// <summary>
        /// 数据起封包 @B#@ 
        /// Start Fixed value :@B#@ 
        /// </summary>
        public String HeadCode = "@B#@";
        /// <summary>
        /// 协议版本号
        /// Protocol version number
        /// </summary>
        public String Protocol = null;
        /// <summary>
        /// 功能代码识别
        /// Function code
        /// </summary>
        public final String FunCode = "045";
        /// <summary>
        /// 国际移动设备身份码
        /// International Mobile Equipment Identity
        /// </summary>
        public String IMEI = null;
        /// <summary>
        /// 国际移动用户识别码
        /// International Mobile Subscriber Identification Number
        /// </summary>
        public String IMSI = null;
        /// <summary>
        /// 如果语音文件分成 2 个包下发，那么这里填充 02
        /// If the voice file is delivered in 2 packages, it is filled here. 02
        /// </summary>
        public int PackageCount  = 0;
        /// <summary>
        /// 分包索引   
        /// Packet Index 
        /// </summary>
        public int PackageIndex  = 0;
        /// <summary>
        ///是否完成   0：未完成  1：完成
        ///Completed 0: Not completed 1: Completed
        /// </summary>
        public int packOver  = 0;
        /// <summary>
        /// 终端当前时间(年月日时分秒) yyyyMMddHHmmss
        /// The terminal current time ( format:yyyyMMddHHmmss)
        /// </summary>
        public String TerminalTime = null;
        /// <summary>
        /// 任务标识，用户自定义，方便回传标识
        /// Task identity, user custom, convenient return identification
        /// </summary>
        public String TaskId = null;
        /// <summary>
        /// 结尾封包 @E#@
        /// End packet @E#@
        /// </summary>
        public String FootCode = "@E#@";



        /// <summary>
        /// 初始化模型
        ///@B#@|01|045|111112222233333|8888888888888888|1|20160715153805|0255BB90395C475E9D6155AF98B383875|@E#@
        /// </summary>
        /// <param name="cmdStr">命令代码</param>
        public C045(String cmdStr)
        {
        	String[] data = cmdStr.split("\\|");
            int dataLength = data.length;
            if (dataLength >= 11 && "@B#@".equals(data[0]) && FunCode.equals(data[2]))
            {
                HeadCode = data[0];
                Protocol = data[1];
                IMEI = data[3];
                IMSI = data[4];
                PackageCount = Integer.parseInt(data[5]);
                PackageIndex = Integer.parseInt(data[6]);
                packOver = Integer.parseInt(data[7]);
                TerminalTime = data[8];
                TaskId = data[9];
                FootCode = data[10];
            }

        }

        public  String ToString()
        {
        	String rString = HeadCode + "|";
            rString += Protocol + "|";
            rString += FunCode + "|";
            rString += IMEI + "|";
            rString += IMSI + "|";
            rString += PackageCount + "|";
            rString += PackageIndex + "|";
            rString += packOver + "|";
            rString += TerminalTime + "|";
            rString += TaskId + "|";
            rString += FootCode;
            return rString;
        }
    }




